using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Drawing;
using System.Drawing.Imaging;

namespace BookStore.Controllers
{
    [HandleError]
    public class CaptchaController : Controller
    {
        public ActionResult Index()
        {
            CaptchaImage ci = new CaptchaImage(this.Session["CaptchaImageText"].ToString(), 156, 30, "Century Schoolbook");

            // Change the response headers to output a JPEG image.
            this.Response.Clear();
            this.Response.ContentType = "image/jpeg";

            // Write the image to the response stream in JPEG format.
            ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);

            // Dispose of the CAPTCHA image object.
            ci.Dispose();
            return View();
        }



    }
}
